package cn.bdqn.util;

import cn.bdqn.exception.IsException;
import cn.bdqn.vo.ResultVo;

//处理前后台参数是否可以成功cn.bdqn.util  :工具包
public class ResultVoUtil {
	/** 成功有返回参数*/
	public static ResultVo success(Object data){
		ResultVo resultVo = new ResultVo();
		resultVo.setCode(0);
		resultVo.setMessage("成功");
		resultVo.setData(data);
		return resultVo;
	}
	/** 成功没有返回参数*/
	public static ResultVo success(){
		return ResultVoUtil.success(null);
	}
	/**  出现异常返回的信息. */
	public static ResultVo error(IsException ex){
		ResultVo resultVo = new ResultVo();
		resultVo.setCode(ex.getCode());
		resultVo.setMessage(ex.getMessage());
		return resultVo;
	}

}
